import java.util.Scanner;
import java.lang.String;


public class Retirement2 {

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);

    print("How much money will you ocntribute every year? ");
    double payment = in.nextDouble();

    print("Interest rate in %: ");
    double interestRate = in.nextDouble();

    int year = 0;
    double balance = 0;
    String input = null;

    // Update account balance while user isn't ready to retire.
    do {
      balance += payment;
      balance += balance * interestRate / 100;

      year++;

      String result = String.format("After year %d, your balance is %,.2f\n", year, balance);
      print(result);

      print("Ready to retire?(Y/N) ");
      input = in.next();
    } while (!input.equalsIgnoreCase("Y"));

  }

  public static void print(String msg) {
    System.out.print(msg);
  }

}
